#!/usr/bin/env python
# -*- coding: utf-8 -*-
# time: 2023/11/1 15:47
# file: yaml_process.py
# author: Yingxiao Zhang

import yaml
import pickle

with open('E:\桌面\huggingface\speech_paraformer-large_asr_nat-en-16k-common-vocab10020-onnx\config.yaml', 'r', encoding='utf-8') as f:
    result = yaml.load(f.read(), Loader=yaml.FullLoader)
# print(list(result['token_list']), type(result['token_list']))
print(len(result['token_list']))


#wb是覆盖写，如果需要追加，则为‘ab'
f = open('token_list.pkl','wb')
#待写入数据
#写入
data= pickle.dump(result['token_list'],f,-1)
#关闭文件
f.close()

f = open('token_list.pkl','rb')
data = pickle.load(f)
print(data)
print(len(data))
f.close()